<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html;charset=UTF-8"%>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>电影列表页面</title>
  <%--设置整个网页的基础路径是：http://localhost:8080/oa/ --%>
  <%--<base href="http://localhost:8080/oa/">--%>
  <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">
</head>
<body>
<h3>欢迎${user.userName}，在线人数${onlinecount}人</h3>
<a href="exit">[退出系统]</a>

<script type="text/javascript">
  function del(movieId){
    var ok = window.confirm("亲，删了不可恢复哦！");
    if(ok){
      /*注意html的base标签可能对JS代码不起作用。所以JS代码最好前面写上"/oa" */
      document.location.href = "${pageContext.request.contextPath}/root/delete?movieId=" + movieId;
    }
  }
</script>

<h1 align="center">电影列表</h1>
<hr >
<table border="1px" align="center" width="50%">
  <tr>
    <th>电影编号</th>
    <th>电影名字</th>
    <th>电影评分</th>
    <th>操作</th>
  </tr>


  <c:forEach items="${movieList}" var="movie">
    <tr>
      <td>${movie.id}</td>
      <td>${movie.movieName}</td>
      <td>${movie.movieScore}</td>
      <td>
        <a href="javascript:void(0)" onclick="del(${movie.id})">删除</a>
        <a href="root/detail?f=edit&movieId=${movie.id}">修改</a>
        <a href="root/detail?f=detail&movieId=${movie.id}">详情</a>
      </td>
    </tr>
  </c:forEach>


</table>

<hr >
<a href="add.jsp">新增电影</a>

</body>
</html>
